<html>
<head>
	<script type="text/javascript">
		var aJaxURL			= "server-side/filials.action.php";		//server side folder url
		//var list_aJaxURL	= "server-side/report/sale/list.action.php";	//server side folder url
		//var seoyURL 		= "server-side/seoy/seoy.action.php";			//server side folder url
		var tName			= "report";										//table name

		$(document).ready(function () {
			GetDate("search_start");
			GetDate("search_end");
			$("#search_start").val('');
			$("#search_end").val('');
			opt('#myselect','client');
			$( "#myselect" ).change(function() {
				opt('#myselect1','c_id');
				LoadTable();
				$('#report').dataTable().columnFilter({aoColumns: [
				{},{ type: "checkbox", values:[ 'სათაო', 'ჯიქია']},{},{},{ type: "checkbox", values: [ 'სათაო', 'ჯიქია']  } ]});
				});
			$( "#myselect1" ).change(function() {
				LoadTable();
				});

		    $(document).on("change", "#search_start", function () {
		    	LoadTable();
		    	opt('#myselect1','c_id');
				LoadTable();
		    });

		    $(document).on("change", "#search_end", function () {
		    	LoadTable();
		    	opt('#myselect1','c_id');
				LoadTable();
		    });
///---------------------------------------

///---------------------------------


		});

		$(document.body).click(function (e) {
        	$("#barcode_client").autocomplete("close");
        });

		function LoadTable(){
			inv 		= $("#myselect1").val();
			var start	= $("#search_start").val();
	    	var end		= $("#search_end").val();
	    	var total = [4, 6];

			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
	    	GetDataTable_s(tName, aJaxURL, "get_list", 7, 'inv='+inv+'&id='+$('#myselect').val()+"&start=" + start + "&end=" + end, 0, "", 1, "desc", total);
			}
		function opt(op,p){
			var c=$("#myselect").val();
			var start	= $("#search_start").val();
	    	var end		= $("#search_end").val();
			  $.ajax({
			        url:aJaxURL,
			        type:'POST',
			        data: 'act='+p+'&id='+c+"&start=" + start + "&end=" + end,
			        success: function( json ) {
			                $(op).html(json.opt);
			                LoadTable();

			        }
			    });
		}
    </script>
 <style type="text/css">
table tr td:nth-child(5){
  	text-align: center;
  }
table tr td:nth-child(6){
  	text-align: right;
  }
table tr td:nth-child(7){
  	text-align: right;
  }
table.display tbody td {
cursor: pointer;
white-space: normal !important;
}
    </style>
</head>

<body>
    <div id="dt_example" class="ex_highlight_row">

        <div id="container" style="width: 850px;padding: 0;margin: auto;">
            <div id="dynamic">
            <div>
				<table style="height: 59px; width: 523px;">
							<tr>
							<td style="width: 160px;">თარიღი<input style="height: auto;" type="text" name="search_start" id="search_start" class="inpt" /></td>
							<td style="padding: 18px 0px 0px 3px; width: 35px;">დან</td>
							<td style="padding: 10px 0px 0px 3px; width: 160px;"><input style="height: auto;" type="text" name="search_end" id="search_end" class="inpt"/>
							</td>
							<td style="padding: 18px 0px 0px 3px;">მდე</td>
							<td></td>
							</tr>
							<!--<tr> <td colspan="5">ან.ფ. ნომერი<select class="inpt" id='myselect1'></select></td> </tr> -->


				</table>
			</div>
            	<h2 align="center">------------</h2>
            	<div id="button_area">
            	</div>
                <table class="display" id="report" style=" white-space: normal !important;">
                    <thead>
                        <tr id="datatable_header">
							<th style="display: none;">id</th>
                            <th style="width: 100%;">ფილიალი</th>
                            <th style="width: 200px;">პროდუქტი</th>
                            <th style="width: 235px;">შესრ. სამუშ.</th>
                           	<th style="width: 50px;">რ-ბა</th>
                           	<th style="width: 60px;">ფასი</th>
                           	<th style="width: 80px;">ღირ–ბა</th>
                        </tr>
                    </thead>
                    <thead >
                        <tr class="search_header">
                            <th style="display: none;"> </th>
                            <th> </th>
                            <th> </th>
                            <th> </th>
                            <th> </th>
                            <th> </th>
                            <th> </th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th style="text-align: right;" >ჯამი:<br>სულ ჯამი:</th>
                            <th>&nbsp;</th>
                            <th style="text-align: right;" >ჯამი:<br>სულ ჯამი:</th>
                            <th>&nbsp;</th>
                        </tr>
                    </tfoot>
                </table>
            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
    <div id="get-dialog" class="form-dialog" title="ბარათები">
    	<!-- aJax -->
	</div>
	<div id="get-letter-dialog" class="form-dialog" title="ბარათები">
    	<!-- aJax -->
	</div>
</body>
</html>